#!/usr/bin/env bash

JAR_PATH="target/trade-manage.war"
JAR_NAME="trade-manage.war"
REMOTE_DIR="/usr/local/www/server/trade-manage-pro/app"
REMOTE_HOST="root@39.98.40.103"


echo "building..."
mvn clean package

echo "copy $JAR_NAME_WITH_VER"
scp  -r $JAR_PATH ${REMOTE_HOST}:${REMOTE_DIR}

echo "upload finish"


ssh  -T ${REMOTE_HOST} << ENDSSH
cd ${REMOTE_DIR}
rm -rf assets
rm -rf META-INF
rm -rf WEB_INF

jar xvf ${JAR_NAME}
exit

ENDSSH